import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.Scanner;

public class TestDemo {
    /**
     * 判断素数的三种方法，优化
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("请输入数");
            int num = scanner.nextInt();
            int i = 2;
            for (; i < num; i++) {
                if (num % i == 0) {
                    System.out.println("不是素数");
                    break;
                }
            }
            if (num == i) {
                System.out.println("是素数");
            }
        }
    }

